package work.MrSun.xyq.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import work.MrSun.xyq.mapper.XyqNewMessageMapper;
import work.MrSun.xyq.model.XyqMessage;
import work.MrSun.xyq.model.XyqNewMessage;
import work.MrSun.xyq.util.SameService;

import java.util.List;

/**
 * @Author MrSun
 * @Date 2023/4/13 19:39
 */

/**
 * 最新消息的实现层
 */
@Service
public class XyqNewMessageService extends SameService<XyqNewMessage> {
    @Autowired
    private XyqNewMessageMapper xyqNewMessageMapper;

    /**
     * 根据用户id查询最新消息
     * @param userId
     * @return
     */
    public List<XyqNewMessage> getAllNewMessage(Integer userId) {
        return xyqNewMessageMapper.getAllNewMessage(userId);
    }

    /**
     * 根据id获取最后的新消息
     * @param id
     * @return
     */
    public XyqNewMessage getLastNewMessage(Integer id) {
        return xyqNewMessageMapper.getLastNewMessage(id);
    }
}
